package com.itcast.flink.screen.database.bo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * <p>Description: </p>
 * @date  
 * @author   
 * @version 1.0
 * @name   
 * <p>Copyright:Copyright(c)2020</p>
 */
@Data
@NoArgsConstructor
@Document(indexName = "screen",type = "hotOrder", shards = 1, replicas = 0)
public class HotOrder {

    @Id
    private Long id;

    public HotOrder(Long goodsId, String goodsName, Long totalAmount, Long timeWindow) {
        this.goodsId = goodsId;
        this.goodsName = goodsName;
        this.totalAmount = totalAmount;
        this.timeWindow = timeWindow;
    }

    /**
     * 商品ID
     */
    @Field(type = FieldType.Keyword)
    private Long goodsId;

    /**
     * 商品名称
     */
    @Field(type = FieldType.Text)
    private String goodsName;

    /**
     * 总成交金额
     */
    @Field(type = FieldType.Long)
    private Long totalAmount;

    /**
     * 时间窗
     */
    @Field(type = FieldType.Long)
    private Long timeWindow;

    /**
     * 数据创建时间
     */
    @Field(type = FieldType.Date)
    private Date createDate;
}
